﻿using DataEditor.DataLayer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DataEditor.ViewModels
{
    public class IndicatorViewModel : BaseDataItemViewModel
    {
        INDICATOR _model;

        #region Constructors

        public IndicatorViewModel(DataLayer.INDICATOR model)
            : base(model.IsValid, model.ValidFrom, model.ValidTo, model.ID)
        {
            this._model = model;
        }

        #endregion



        #region Properties

        public INDICATOR Model
        {
            get { return _model; }
        }

        public String Name
        {
            get { return _model.NAME; }
            set
            {
                _model.NAME = value;
                NotifyOfPropertyChange(() => Name);
            }
        }

        public String Description
        {
            get { return _model.DESCRIPTION; }
            set
            {
                _model.DESCRIPTION = value;
                NotifyOfPropertyChange(() => Description);
            }
        }

        public String Abbreviation
        {
            get { return _model.ABBREVIATION; }
            set
            {
                _model.ABBREVIATION = value;
                NotifyOfPropertyChange(() => Abbreviation);
            }
        }

        public INDICATOR_TYPE IndicatorType
        {
            get
            {
                return _model.INDICATOR_TYPE;
            }
            set
            {
                _model.INDICATOR_TYPE = value;
                NotifyOfPropertyChange(() => IndicatorType);
            }
        }

        public UNIT Unit
        {
            get
            {
                return _model.UNIT;
            }
            set
            {
                _model.UNIT = value;
                NotifyOfPropertyChange(() => Unit);
            }
        }

        public List<INDICATOR_TYPE> IndicatorTypes
        {
            get
            {
                return dataContext.INDICATOR_TYPE.ToList<INDICATOR_TYPE>();
            }
        }

        public List<UNIT> UnitTypes
        {
            get
            {
                return dataContext.UNITs.ToList<UNIT>();
            }
        }

        #endregion
    }
}
